﻿Public Class fTipoProducto
    Dim daTipoProd As lbGlobalcom.dsProductosTableAdapters.PRO_TIPOPRODUCTOTableAdapter
    Private Sub btnCargar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCargar.Click
        Try
            If DsProductos.PRO_TIPOPRODUCTO.GetChanges IsNot Nothing Then
                If MessageBox.Show("Hay registros pendientes por salvar, desea guardarlos", "Salvar Cambios", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = Windows.Forms.DialogResult.Yes Then
                    PRO_TIPOPRODUCTOBindingNavigatorSaveItem.PerformClick()
                End If
            End If
            daTipoProd.Fill(DsProductos.PRO_TIPOPRODUCTO)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Private Sub fTipoProducto_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Try
            daTipoProd = New lbGlobalcom.dsProductosTableAdapters.PRO_TIPOPRODUCTOTableAdapter
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try

    End Sub

    Private Sub PRO_TIPOPRODUCTOBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PRO_TIPOPRODUCTOBindingNavigatorSaveItem.Click
        Try
            daTipoProd.Update(DsProductos.PRO_TIPOPRODUCTO)
            MessageBox.Show("Se salvarón registros con exito", "Salvar Registros", MessageBoxButtons.OK, MessageBoxIcon.Information)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Private Sub PRO_TIPOPRODUCTODataGridView_UserDeletedRow(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewRowEventArgs) Handles PRO_TIPOPRODUCTODataGridView.UserDeletedRow
        Try
            MessageBox.Show("Se elimino Tipo Producto con exito", "Elimina Registro", MessageBoxButtons.OK, MessageBoxIcon.Information)
            daTipoProd.Update(DsProductos.PRO_TIPOPRODUCTO)
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
    End Sub

    Private Sub PRO_TIPOPRODUCTODataGridView_UserDeletingRow(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewRowCancelEventArgs) Handles PRO_TIPOPRODUCTODataGridView.UserDeletingRow
        If MessageBox.Show("esta seguro que desea eliminar este registro", "Elimina Registro", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = Windows.Forms.DialogResult.No Then
            e.Cancel = True
        End If
    End Sub
End Class